using Godot;

public partial class 音频播放节点脚本 : AudioStreamPlayer
{
    public override void _Ready()
    {
        Playing = true;
        Finished += finished;
    }

    public override void _Process(double delta)
    {
        
        if (Input.IsActionJustPressed("c"))
        {
            if (Playing == true)
            {
                StreamPaused = true;
                GD.Print($"playing is {Playing}");
            }


        }
        if (Input.IsActionJustPressed("x"))
        {
            if (Playing == false)
            {
                StreamPaused = false;
                GD.Print($"playing is {Playing}");
            }
        }
        if (Input.IsActionJustPressed("空格"))
        {
            if (Playing)
            {
                Stop();
            }
            else
            {
                Play();
            }
        }
    }

    public void finished()
    {
        Play();
    }

}
